//
//  DLAddressSelectionViewController.h
//  DGGUISpaceSDK
//
//  Created by 伍明鹏 on 2019/12/12.
//

#import <UIKit/UIKit.h>
@class DLAddressSelectionOption;

//selectedOption 已选择地区的数据
typedef void (^SelectedOptionsBlock)(DLAddressSelectionOption *selectedOption);
//selectedOption 最终选择的选项   next 是否获取下级数据,YES:是,NO:否
typedef void (^DisplayOptionsBlock)(DLAddressSelectionOption *selectedOption, BOOL next);
//chooseOptions 多选选中的数据
typedef void (^MultiselectComplet)(NSArray<DLAddressSelectionOption *> *chooseOptions);

@interface DLAddressSelectionViewController : UIView
    
//=================================界面属性=====================
//展示待选项数组的tableView
@property (weak, nonatomic) IBOutlet UITableView *tableView;
//主题色
@property (nonatomic, strong) UIColor *tintColor;
//展示的标题
@property (nonatomic, copy) NSString *showTitle;
//分割线颜色
@property (nonatomic, strong) UIColor *lineColor;
//右上角关闭按钮图标
@property (nonatomic, strong) UIImage *closeImg;
//scrollView上按钮字体大小
@property (nonatomic, strong) UIFont *scrollViewTitleFont;
//scrollView上按钮字体大小
@property (nonatomic, strong) UIColor *scrollViewTitleColor;
//主标题字体类型大小
@property (nonatomic, strong) UIFont *titleFont;
//主标题字体颜色
@property (nonatomic, strong) UIColor *titleColor;


//=================================数据属性=====================
//最终选择的选项(单选时设置)
@property (nonatomic, strong) DLAddressSelectionOption *selectedOption;
//最后层级是否多选
@property (nonatomic, assign) BOOL multiselect;
//最后层级选中的选项(多选时设置)
@property (nonatomic, strong) NSMutableArray<DLAddressSelectionOption *> *chooseOptions;
//可自定义Cell
@property (nonatomic, copy)UITableViewCell *(^cell)(NSIndexPath *);
//已选项数组
@property (nonatomic, strong) NSMutableArray *selectedOptions;
//待选项数组
@property (nonatomic, strong) NSMutableArray *displayOptions;
    
    
//=================================操作回调=====================
//用于已选择地区后点击地区回显的回调，回调中updateSelectedOptions:方法刷新UI(单选)
@property (nonatomic, copy) SelectedOptionsBlock selectedOptionsBlock;
//用于获取需要选择的选项数组(tableView展示),获取成功请调用updateDisplayOptions:方法刷新UI
@property (nonatomic, copy) DisplayOptionsBlock displayOptionsBlock;
//多选确认选择回调
@property (nonatomic, copy) MultiselectComplet multiselectComplet;
    
//=================================操作回调=====================
   
+ (instancetype)initAddressSelectionView;

/**
 在viewController中展示
 @param viewController 需要展示的viewController
 */
- (void)showInViewController:(UIViewController *)viewController;

/**
 更新已选项数组，回显的时候更新界面
 @param selectedOptions 已选项数组
 */
- (void)updateSelectedOptions:(NSMutableArray *)selectedOptions;

/**
 更新已选项数组，回显的时候更新界面
 @param selectedOptions 已选项数组
 @param show 是否展示默认按钮
 @param animation 是否动画展示
 */
- (void)updateSelectedOptions:(NSMutableArray *)selectedOptions showDefaultBtn:(BOOL)show animation:(BOOL)animation;

/**
 调接口返回地区数据，刷新地区展示界面
 @param displayOptions 待选项数组
 */
- (void)updateDisplayOptions:(NSMutableArray *)displayOptions;

/**
 手动点击某一项
 @param item 待选项数组
 */
- (void)selectWithItem:(DLAddressSelectionOption *)item;

@end
